//
//  LVCollectionViewCell.m
//  彩虹儿歌
//
//  Created by HelloWorld_L on 15/7/2.
//  Copyright (c) 2015年 HelloBaby. All rights reserved.
//

#import "LVCollectionViewCell.h"
#import "MacroHeader.h"
#import <UIImageView+WebCache.h>
@implementation LVCollectionViewCell

- (void)dealloc
{
    [_coverImgV release];
    [_titleLab release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.coverImgV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, (SCREEN_WIDTH - 40) / 3, (SCREEN_WIDTH - 40) / 3)];
        
        self.titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, (SCREEN_WIDTH - 40) / 3, (SCREEN_WIDTH - 40) / 3, 30)];
        self.titleLab.backgroundColor = [UIColor colorWithRed:120 / 255.0 green:211 / 255.0 blue:250 / 255.0 alpha:0.3];
        self.titleLab.font = [UIFont systemFontOfSize:15];
        self.titleLab.textAlignment = NSTextAlignmentCenter;
        self.titleLab.layer.cornerRadius = 10;
        self.titleLab.layer.masksToBounds = YES;
        
        [self.contentView addSubview:self.coverImgV];
        [self.contentView addSubview:self.titleLab];
        [self.coverImgV release];
        [self.titleLab release];
        
    }
    return self;
}

- (void)setModel:(LVCModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [self.coverImgV sd_setImageWithURL:[NSURL URLWithString:[model.icon objectForKey:@"url"]]];
    
    self.titleLab.text = model.name;
    
}

@end
